<?php 
ob_start();
session_start();
include('database.php');
include('gest_login.php');
include('languages/it.php');
reserved_page();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<noscript><meta http-equiv="refresh" content="0; url=jserror.html"></noscript>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>RagusaInFoto</title>
<script language="Javascript" src="js/functions.js"></script> 
</head>

<body>
<p><?php echo $_SESSION['user']; ?> | <a href="load.php">Carica Foto</a> | <a href="profile.php">Profilo</a> | <a href="logout.php">Logout</a></p>

<?php
if(isset($_POST['name']))
	echo (update_user_data($_POST['name'], $_POST['name_old'], $_POST['surname'], $_POST['surname_old'], $_POST['place'], $_POST['place_old'], $_SESSION['id']));

if(isset($_POST['mail']))
	echo (update_user_mail($_POST['mail'], $_POST['mail_old'], $_SESSION['id']));

if(isset($_POST['pass_old']))
	echo update_user_pass($_POST['pass_old'], $_POST['pass_old_db'], $_POST['pass_new_1'], $_POST['pass_new_2'], $_SESSION['id']);

if(isset($_POST['delete_user']))
	echo delete_user($_SESSION['id']);


if(!$_SESSION['id_fb'])
	get_user_data($_SESSION['id']);
else
	echo "<p>".CONNECTED_FROM_FACEBOOK."</p>"
?>
</body>
</html>
